﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Util;
using BLO.News;

public partial class FrontEnd_MasterPage : System.Web.UI.MasterPage
{
    //Server Information
    public String cssPath;
    public String imagePath;
    public String userDataPath;
    public String jsPath;
    public BLO.BlogOption option;

    public BLO.User Owner;
    public BLO.User LoginUser;
    public Boolean viewMyOwnBlog = false;

    protected void Page_Load(object sender, EventArgs e)
    {
        if(Session["LoginUser"] == null)
            Response.Redirect("~/FrontEnd/Register.aspx");
        else
        {
            String loginUserID = Session["LoginUser"].ToString();
            String ownerID = Request.Params.Get("ID");

            if (ownerID == null)
            {
                ownerID = loginUserID;
                viewMyOwnBlog = true;
            }

            // Init Server Information
            cssPath = Server.MapPath(ServerPath.CSS);
            imagePath = Server.MapPath(ServerPath.Image);
            userDataPath = Server.MapPath(ServerPath.UserData);
            jsPath = Server.MapPath(ServerPath.Javascript);

            // Get the current log-in user
            Owner = BLO.User.GetUser(ownerID);
            LoginUser = BLO.User.GetUser(loginUserID);

            option = new BLO.BlogOption(Server.MapPath(Util.ServerPath.UserData + ownerID + "/Module.xml"));
        }
    }
}
